﻿using System;
using CppUT.Common;
using System.IO;
using System.Diagnostics;
using System.Threading;

namespace ManagedApp
{
    public class Program
    {
        public static void Main(string[] args)
        {
            try
            {
                Log.Initialize("Server.log");
                Log.MethodEntry();
                
                //string dllPath = @"D:\DevStuff\VSUnit++\CppUtVob\CppUnitTestRunner\Debug\AppTest.dll";
                string dllPath = args[0];
                if (File.Exists(dllPath))
                {
                    var standAloneTestRunner = new StandAloneTestRunner(dllPath);
                    standAloneTestRunner.Listen();
                }
                else
                {
                    ErrorManager.LogException(new FileNotFoundException("Cannot find " + dllPath));
                }

                Console.ReadLine();
                Log.MethodExit();
            }
            catch (Exception ex)
            {
                Log.Info(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.InnerException);
            }
        }
    }
}
